package org.agridata.akvisualization.map;

import java.util.Map;

public class MapUtil {

    /**
     * 从map集合中获取字符串
     * @param paramMap
     * @param key
     * @return
     */
    public static String getString(Map<String, Object> paramMap, String key) {
        if (paramMap == null || key == null) return null;
        try {
            Object o = paramMap.get(key);
            if(o != null )
                return o.toString();
           return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }


    /**
     * 从map集合中获取Integer数据
     * @param paramMap
     * @param key
     * @return
     */
    public static Integer getInteger(Map<String, Object> paramMap, String key) {
        if (paramMap == null || key == null) return null;
        try {
            Object o = paramMap.get(key);
            if(o != null)   return Integer.parseInt(paramMap.get(key).toString());
           return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

}
